package com.bonc.controller;

import com.bonc.entity.ParkCompanyPerson;
import com.bonc.service.ParkCompanyPersonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 努力！奋斗！
 * 理解的快不等于理解的好！
 *
 * @author LRJ
 * @Date 2021/08/03  14:07
 **/
@Api(value = "ParkCompanyController", description = "用户操作")
@RestController
@Slf4j
public class ParkCompanyPersonController {
    @Autowired
    private ParkCompanyPersonService parkCompanyPersonService;

    /**
     * 修改关注状态
     *
     * @param followStatus
     * @param id
     * @return
     */
    @ApiOperation(notes = "修改关注状态", value = "修改关注状态", response = ParkCompanyPerson.class, httpMethod = "POST")
    @PostMapping("/upDataFollowStatus")
    public @ResponseBody
    ParkCompanyPerson upDataFollowStatus(@RequestParam(value = "followStatus",required = false) String followStatus, @RequestParam(value = "id") String id) {
        if (parkCompanyPersonService.PfindById(id).getFollowStatus().equals("0")){
            followStatus = "1";
        }else {
            followStatus = "0";
        }
        Integer total = parkCompanyPersonService.upDataFollowStatus(followStatus, id);
        log.info("修改的数据数目为:{}",total);
        return parkCompanyPersonService.PfindById(id);
    }

}
